﻿using Company.Application.Main.Views;
using Company.Application.Share.Prism;
using Company.Core.IOC;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Company.Application.Main
{
    [Module(OnDemand = true)] // 这里可以标记延迟加载，因为如果登录不成功就不加载
    [ModuleDependency(ModuleNames.MenuModule)]
    [ModuleDependency(ModuleNames.ImageModule)]
    public class MainModule : IModule
    {
        public void OnInitialized(IContainerProvider containerProvider)
        {
            /// 等于下面的方式
            /// containerProvider.Resolve<IRegionManager>().RegisterViewWithRegion<MainView>(RegionNames.MainRegion);
            PrismProvider.RegionManager.RegisterViewWithRegion<MainView>(RegionNames.MainRegion);
        }

        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterForNavigation<MainView>();
        }
    }
}
